
Import('image_build','dev_env')

src = [
    'FlashPrg.c',
    'FlashDev.c'
]
inc = [
    '.'
]
if not 'mdk' in dev_env['TOOLS']:
    flash_prog_env,flash_prog_target = image_build('flash_prog',src,inc,'flash_prog_link.txt')
    flash_prog_env.Append(CPPDEFINES = ['GLOBAL_OUTPUT_LVL=0', 'FLASH_PROG_ALGO']) 
    flash_prog_env.Append(CFLAGS = ' -fPIE ')
    flash_prog_env.Append(LINKFLAGS = ' -nostartfiles -Wl,-n')
    flash_prog_env.AddPostAction(flash_prog_target,Copy('tools/prog/LinkedSemi/${IC}_flash_algo.elf','$TARGET'))